import type { UserInfo } from '@vben/types';

// import { requestClient } from '#/api/request';
import { requestClient } from '#/api/request';

interface Userinfo {
  roles?: string[];
  homePath?: string;
}

export interface Params {
  any: any[];
}

export interface User {
  searchValue: null;
  createBy: string;
  createTime: Date;
  updateBy: null;
  updateTime: null;
  remark: null;
  params: Params;
  userId: number;
  deptId: null;
  userName: string;
  nickName: string;
  email: string;
  phonenumber: string;
  sex: string;
  avatar: string;
  salt: null;
  status: string;
  delFlag: string;
  loginIp: string;
  loginDate: Date;
  dept: null;
  roles: any[];
  roleIds: null;
  postIds: null;
  roleId: null;
  admin: boolean;
}

export interface UserApi {
  msg: string;
  code: number;
  permissions: any[];
  roles: any[];
  user: User;
}
/**
 * 获取用户信息
 */
export async function getUserInfoApi() {
  return requestClient.get<UserInfo>('/user/info');
  // return requestClient.get<UserInfo>('/getInfo');
}

export async function getUserinfoApi() {
  // return requestClient.get<UserInfo>('/user/info');
  return requestClient.get<Userinfo>('http://100.122.211.103:8080/getInfo');
}

// 获取路由信息
export async function getUserRoutesApi() {
  return requestClient.get('http://100.122.211.103:8080/getRouters');
}
